
#include <iostream>

using namespace std;

class student_t
{
public:
    student_t(int n, int a, float s):num(n),age(n),score(s){}
    void total()
    {
        count ++;
        sum += score;
        cout<<"sum="<<sum<<endl;
    }
    static float average();

private:
    int num;
    int age;
    float score;
    static float sum;
    static int count;
};

float student_t::sum = 0;
int student_t::count = 0;

float student_t::average()
{
    return sum/count;
}

int main(void)
{
    student_t stu[3]=
    {
        student_t(0411, 18, 87),
        student_t(0432, 20, 43),
        student_t(0413, 17, 85),
    };
    int i;
    for(i=0; i<3; ++i)
    {
        stu[i].total();
    }
    cout<<"sorce aver = "<<student_t::average()<<endl;

    return 0;
}

